$('select[name="type"]').cssSelect();
$('input[name="submit"]').click(function (){
	var name=$('input[name="name"]'),
		  email=$('input[name="email"]'),
		  subject=$('input[name="subject"]'),
	      type=$('select[name="type"]'),
	      content=$('textarea[name="content"]');

	if(name.val().replace(/[ ]/g, '').length<3){
		var tips='What\'s your name?';
		name.focus();
	}else if(! is_email(email.val())){
		var tips='Please give us an available  EMAIL !';
		email.focus();
	}else if (subject.val().replace(/[ ]/g, '').length<10){
		var tips='Please enter a subject for your message at lease 10 words !';
		subject.focus();
	}else if (type.val()==0){
		var tips='Please select a message type item !';
		type.focus();
	}else if (content.val().replace(/[ ]/g, '').length<10){
		var tips='The message content needs to be at lease 10 words !';
		content.focus();	
	}else{
		var $data={
				uname: name.val(),
				email: email.val(),
				subject: subject.val(),
				message: content.val(),
				msgtype: type.val(),
				from: 'contact'
		};
		$.post($msgUrl, $data,function (back){
			if(back.status==1){
				ZENG.msgbox.show('Message Sent, We\'ll take a serious look at your message,Think U !', 4, 3000);
				name.val('');
				email.val('');
				subject.val('');
				content.val('');
				type.val(0);
				$('select[name="type"]').cssSelect();
			}else{
				ZENG.msgbox.show('Sending Failed ! Please Try Again Later! ', 1, 3000);
			}
		}, 'json');
		return false;
	}		
		ZENG.msgbox.show(tips, 5, 3000);
});

/**************** BEGIN 函数集成************************/
function formResponse(){
	if($(window).width()<550){
		$('.middle_content').addClass('mini');
	}else{				
		$('.middle_content').removeClass('mini');		
	}
}
/**************** END 函数集成************************/